package lang;

import java.util.ArrayList;

/**
 * User: Test
 * Date: 15.03.2008
 * Time: 14:48:16
 */
public class SQLQueryErrorNearException extends Throwable
{
    private String message = "";

    public SQLQueryErrorNearException(ArrayList< SQLQueryToken > tokens, SQLQueryToken badToken, String state) throws
            SQLQueryErrorNearException {
        String foundAt = "";
        int nI = 0;
        while (tokens.get(nI) != badToken) {
            foundAt = tokens.get(nI).getValue() + " ";
            nI++;
        }
        foundAt += "[" + badToken + "]";
        message = "Error found near: " + foundAt + ";\n Current state : " + state;
    }


    public String getMessage() {
        return message;
    }
}